package com.jy.rhin.facade.cda;

import com.jy.framework.base.entity.Result;
import com.jy.rhin.application.cda.QianZhiJDApplication;
import com.jy.rhin.facade.cda.dto.QianZhiJDPZWJDto;
import com.jy.rhin.sdk.dto.document.query.DocumentValidateResultDto;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@Slf4j
@RequestMapping("/qianzhijd")
@Api(tags = "全民健康信息平台-前置节点api", hidden = true)
@RestController
public class QianZhiJDController {

    @Autowired
    private QianZhiJDApplication qianZhiJDApplication;


    @ApiOperation("查询文件配置")
    @GetMapping("/chaxun")
    public Result<QianZhiJDPZWJDto>  ChaXun() {
        return Result.success(qianZhiJDApplication.getPeiZhi());
    }


    @SneakyThrows
    @ApiOperation("修改文件配置")
    @PostMapping("/xiugaipz")
    public Result<Boolean>  updateConfig(@RequestBody QianZhiJDPZWJDto dto) {
        return Result.success(qianZhiJDApplication.updateConfig(dto));
    }


    @SneakyThrows
    @ApiOperation("校验文档")
    @PostMapping("/jiaoyanwd")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "ossUrl", value = "文件地址", required = true)
    })
    public Result<DocumentValidateResultDto> jiaoYanWD(@RequestParam("ossUrl") String  ossUrl) {
        return Result.success(qianZhiJDApplication.jiaoYanWD(ossUrl));
    }

}
